/**
 * @param {number[]} nums
 * @return {number[]}
 */
 var sortEvenOdd = function(nums) {
  let one = [], two = []
  for(let i = 0; i<nums.length; i++){
    if(i & 1) one.push(nums[i])
    else two.push(nums[i])
  }
  one.sort((a,b) => b-a)
  two.sort((a,b) => a-b)
  let ans = []
  for(let i = 0; i<Math.max(one.length, two.length); i++){
    if(i < two.length) ans.push(two[i])
    if(i < one.length) ans.push(one[i])
  }
  return ans
};